//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.ruoyi.web.controller.user;

import com.ruoyi.live.app.service.CacheService;
import com.ruoyi.live.base.domain.*;
import com.ruoyi.live.base.domain.vo.ExpertProgress;
import com.ruoyi.live.base.domain.vo.TimeLine;
import com.ruoyi.live.exam.domain.ScoreObjDetail;
import com.ruoyi.live.register.utils.RegisterContant;
import com.ruoyi.live.tool.utils.Message;
import com.ruoyi.live.user.service.ExpertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping({"/expert"})
public class ExpertController {
    @Autowired
    ExpertService service;
    @Autowired
    CacheService cacheService;

    public ExpertController() {
    }

    @ResponseBody
    @RequestMapping({"/judge/list"})
    public List<LiveExamJudge> list(Long examId) {
        return this.service.list(examId);
    }

    @ResponseBody
    @RequestMapping({"/judge/getJudgeQueue"})
    public List<LiveExamJudge> getJudgeQueue(Long examId) {
        return this.service.getJudgeQueue(examId);
    }

    @ResponseBody
    @RequestMapping({"/judge/getScoreState"})
    public Message getScoreState(Long examId) {
        return this.service.getScoreState(examId);
    }

    @ResponseBody
    @RequestMapping({"/judge/getScoreNeed"})
    public Message getScoreNeed(Long id, Long examUserId) {
        try {
            return this.service.doGetScoreNeed(id, examUserId);
        } catch (Exception var4) {
            var4.printStackTrace();
            return new Message(false, "加载评审内容失败");
        }
    }

    @ResponseBody
    @RequestMapping({"/judge/loadShopRules"})
    public List<LiveScoreStandard> loadShopRules(Integer type, Long examUserId) {
        try {
            return this.service.loadShopRules(type, examUserId);
        } catch (Exception var4) {
            var4.printStackTrace();
            return null;
        }
    }

    @ResponseBody
    @RequestMapping({"/judge/score/start"})
    public Message score(Long examId, Long examUserId, Long judgeId) {
        try {
            return this.service.score(examId, examUserId, judgeId);
        } catch (Exception var5) {
            var5.printStackTrace();
            return new Message(false, "开始评审失败");
        }
    }

    @ResponseBody
    @RequestMapping({"/judge/score/getTimeIndex"})
    public Map<String, List<Integer>> getTimeIndex(Long examUserId) {
        return this.service.getTimeIndex(examUserId);
    }

    @ResponseBody
    @RequestMapping({"/judge/endEmptyJudge"})
    public Message endEmptyJudge(Long id) {
        try {
            this.service.doEndEmptyJudge(id);
            return new Message(true, "");
        } catch (Exception var3) {
            var3.printStackTrace();
            return new Message(false, "");
        }
    }

    @ResponseBody
    @RequestMapping({"/judge/setScore"})
    public Message setScore(LiveExamExpertDetail detail) {
        try {
            this.service.setScore(detail);
            return new Message(true, "评分成功");
        } catch (Exception var3) {
            var3.printStackTrace();
            return new Message(false, "评分失败");
        }
    }

    @ResponseBody
    @RequestMapping({"/judge/getVideoPath"})
    public Message getVideoPath(Long id) {
        try {
            return this.service.getVideoPath(id);
        } catch (Exception var3) {
            var3.printStackTrace();
            return new Message(false, "获取视频地址失败");
        }
    }

    @ResponseBody
    @RequestMapping({"/judge/getBarrage"})
    public List<LiveBarrageChannel> getBarrage(Integer start, Integer end, Long id) {
        try {
            return this.service.getBarrage(start, end, id);
        } catch (Exception var5) {
            var5.printStackTrace();
            return new ArrayList();
        }
    }

    @ResponseBody
    @RequestMapping({"/judge/getScoreData"})
    public List<LiveExamExpertDetail> getScoreData(Long id) {
        return this.service.getScoreData(id);
    }

    @ResponseBody
    @RequestMapping({"/getProductDetailById"})
    public LiveProductItem getProductDetailById(Long id) {
        return this.service.getProductDetailById(id);
    }

    @ResponseBody
    @RequestMapping({"/endJudge"})
    public Message endJudge(Long id) {
        try {
            if (RegisterContant.standardType()) {
                return "2".equals(this.cacheService.getParam("USE_WORLD_RULE")) ? this.service.doEndJudgeZZ(id) : this.service.doEndJudge(id);
            } else {
                return this.service.doEndJudgeZZ(id);
            }
        } catch (Exception var3) {
            var3.printStackTrace();
            return new Message(false, "");
        }
    }

    @ResponseBody
    @RequestMapping({"/list/student"})
    public List<LiveExamJudge> listStudent(Long examId) {
        return this.service.listStudent(examId);
    }

    @ResponseBody
    @RequestMapping({"/checkScoreId"})
    public Message checkScoreId(Long id) {
        try {
            this.service.checkScoreId(id);
            return new Message(true, "改变状态成功");
        } catch (Exception var3) {
            var3.printStackTrace();
            return new Message(true, "改变状态失败");
        }
    }

    @ResponseBody
    @RequestMapping({"/getTimeLine"})
    public List<TimeLine> getTimeLine(Long channelId) {
        return new ArrayList();
    }

    @ResponseBody
    @RequestMapping({"/getExpertProgress"})
    public List<ExpertProgress> getExpertProgress(Long examUserId) {
        return new ArrayList();
    }

    @ResponseBody
    @RequestMapping({"/getExpertState"})
    public Message getExpertState(Long id) {
        return this.service.getExpertState(id);
    }

    @RequestMapping({"/judge/scoreOne"})
    @ResponseBody
    public List<LiveExamJudge> scoreOne(Long examId) {
        return this.service.scoreOne(examId);
    }

    @RequestMapping({"/judge/loadAllRules"})
    @ResponseBody
    public List<LiveScoreStandard> loadAllRules(Long examUserId) {
        return this.service.loadAllRules(examUserId);
    }

    @RequestMapping({"/judge/getScoreDetail"})
    @ResponseBody
    public List<ScoreObjDetail> getScoreDetail(Long examUserId) {
        return this.service.getScoreDetail(examUserId);
    }

    @RequestMapping({"/resetExpertState"})
    @ResponseBody
    public Message resetExpertState(Long examUserId) {
        try {
            this.service.doResetExpertState(examUserId);
            return new Message(true, "重置成功");
        } catch (Exception var3) {
            var3.printStackTrace();
            return new Message(false, "重置失败");
        }
    }
}
